package com.jishaokang.controller;

import com.jishaokang.base.Result;
import com.jishaokang.model.dto.Comment;
import com.jishaokang.model.dto.Learn;
import com.jishaokang.service.LearnService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpSession;

/**
 * Created by NANA_Final on 2019/6/21.
 */
@RestController
@RequestMapping(value = "/api")
public class LearnController {

    @Autowired
    private LearnService learnService;

    //------------------------------------------
    @RequestMapping(value = "/user/learn/selectLearnByCourseIdAndUserId",method = RequestMethod.POST)
    public Result selectLearnByCourseIdAndUserId(@RequestBody Learn learn) {
        return learnService.selectLearnByCourseIdAndUserId(learn);
    }

    @RequestMapping(value = "/user/learn/addLearn",method = RequestMethod.POST)
    public Result addLearn(@RequestBody Learn learn) {
        return learnService.addLearn(learn);
    }

    @RequestMapping(value = "/all/learn/selectCourseComment",method = RequestMethod.POST)
    public Result selectCourseComment(@RequestBody Learn learn) {
        return learnService.selectCourseComment(learn);
    }

    @RequestMapping(value = "/user/learn/updateCourseComment",method = RequestMethod.POST)
    public Result updateCourseComment(@RequestBody Learn learn) {
        return learnService.updateCourseComment(learn);
    }

    @RequestMapping(value = "/user/learn/deleteCourseComment",method = RequestMethod.POST)
    public Result deleteCourseComment(@RequestBody Learn learn) {
        return learnService.deleteCourseComment(learn);
    }

    @RequestMapping(value = "/user/learn/updateLearnHistory",method = RequestMethod.POST)
    public Result updateLearnHistory(@RequestBody Learn learn) {
        return learnService.updateLearnHistory(learn);
    }

    @RequestMapping(value = "/user/learn/selectLearnByUserId",method = RequestMethod.POST)
    public Result UserSelectLearnByUserId(@RequestBody Learn learn) {
        return learnService.selectLearnByUserId(learn);
    }
    //-----------------------------------------
    @RequestMapping(value = "/admin/learn/selectLearnByUserId",method = RequestMethod.POST)
    public Result selectLearnByUserId(@RequestBody Learn learn) {
        return learnService.selectLearnByUserId(learn);
    }

    @RequestMapping(value = "/admin/learn/selectLearn",method = RequestMethod.POST)
    public Result selectLearn(@RequestBody Learn learn) {
        return learnService.selectLearn(learn);
    }

    @RequestMapping(value = "/admin/learn/selectLearnByCostDesc",method = RequestMethod.POST)
    public Result selectLearnByCostDesc(@RequestBody Learn learn) {
        return learnService.selectLearnByCostDesc(learn);
    }

    @RequestMapping(value = "/admin/learn/selectLearnByUsername",method = RequestMethod.POST)
    public Result selectLearnByUsername(@RequestBody Learn learn) {
        return learnService.selectLearnByUsername(learn);
    }

}